/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 * File Name     : roce_bond_register.c
 * Version       : v2.0
 * Created       : 2021/12/7
 * Last Modified : 2022/3/24
 * Description   : The definition of RoCE bond unregister functions.
 */

#ifdef ROCE_BONDING_EN

#include <rdma/ib_user_verbs.h>
#include <rdma/ib_addr.h>
#include <rdma/ib_cache.h>

#include <net/bonding.h>

#include "hinic3_hw.h"

#include "roce_bond.h"
#include "roce_cmd.h"

void roce3_bond_unregister(struct roce3_device *rdev)
{
    struct roce3_bond_device *bond_dev = NULL;

    bond_dev = roce3_bond_dev_get(rdev->pdev, true);
    if (bond_dev == NULL) {
        return;
    }

    if (bond_dev->nb.notifier_call) {
        unregister_netdevice_notifier(&bond_dev->nb);
        bond_dev->nb.notifier_call = NULL;
    }

    cancel_delayed_work_sync(&bond_dev->bond_work);
}

#endif
